from django.conf.urls.defaults import *

from tasks.feeds import AllTaskFeed


tasks_feed_dict = {"feed_dict": {
    "all": AllTaskFeed,
}}


urlpatterns = patterns("taskberry.apps.tasks.views",
    url(r"^$", "tasks", name="task_list"),
    url(r"^(?P<field>planned_date|modified|state|assignee|tag)/(?P<value>[^/]+)/$", "focus", name="task_focus"),
    url(r"^add/$", "add_task", name="task_add"),
    url(r"^add/with-paste/(?P<secret_id>\w+)/$", "add_task", name="task_add_paste"),
    url(r"^task/(?P<id>\d+)/$", "task", name="task_detail"),
    url(r"^(?P<username>[-\w]+)/tasks_today/$", "tasks_today", name="tasks_today"),
    url(r"^(?P<username>[-\w]+)/tasks_today/work/(?P<id>\d+)/$", "worked_on", name="worked_on"),
    url(r"^(?P<username>[-\w]+)/tasks_today/close/(?P<id>\d+)/$", "close", name="close"),
    url(r"^(?P<username>[-\w]+)/planning/$", "planning", name="planning"),
    url(r"^(?P<username>[-\w]+)/planning/plan/(?P<id>\d+)/$", "plan", name="plan"),
    url(r"^(?P<username>[-\w]+)/planning/unplan/(?P<id>\d+)/$", "unplan", name="unplan"),
    url(r"^(?P<username>[-\w]+)/tasks_for_user/$", "user_tasks", name="tasks_for_user"),
    url(r"^mini_list/$", "mini_list", name="tasks_mini_list"),
    
    # history
    url(r"^history/$", "tasks_history_list", name="tasks_history_list"),
    url(r"^history/(?P<id>\d+)/$", "tasks_history", name="tasks_history"),
    
    # nudge
    url(r"^nudge/(?P<id>\d+)/$", "nudge", name="tasks_nudge"),
    
    # exports
    url(r"^export_state_transitions.csv$", "export_state_transitions", name="tasks_export_state_transitions"),
)

urlpatterns += patterns("",
    # feeds
    (r"^feeds/(.*)/$", "django.contrib.syndication.views.feed", tasks_feed_dict),
)
